1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module shumate.Marker;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.AccessibleIF;
30 private import gtk.AccessibleT;
31 private import gtk.BuildableIF;
32 private import gtk.BuildableT;
33 private import gtk.ConstraintTargetIF;
34 private import gtk.ConstraintTargetT;
35 private import gtk.Widget;
36 private import shumate.LocationIF;
37 private import shumate.LocationT;
38 private import shumate.c.functions;
39 public  import shumate.c.types;
40 
41 
42 /**
43  * Markers represent points of interest on a map. Markers need to be
44  * placed on a layer (a [class@MarkerLayer]). Layers have to be added to a
45  * [class@Map] for the markers to show on the map.
46  * 
47  * A marker is nothing more than a regular [class@Gtk.Widget]. You can draw on
48  * it what ever you want. Set the marker's position on the map using
49  * [method@Location.set_location].
50  * 
51  * This is a base class of all markers. A typical usage of a marker is for
52  * instance to add a [class@Gtk.Image] with a pin image and add the
53  * [class@Gtk.GestureClick] controller to listen to click events and show
54  * a [class@Gtk.Popover] with the description of the marker.
55  */
56 public class Marker : Widget, LocationIF
57 {
58 	/** the main Gtk struct */
59 	protected ShumateMarker* shumateMarker;
60 
61 	/** Get the main Gtk struct */
62 	public ShumateMarker* getMarkerStruct(bool transferOwnership = false)
63 	{
64 		if (transferOwnership)
65 			ownedRef = false;
66 		return shumateMarker;
67 	}
68 
69 	/** the main Gtk struct as a void* */
70 	protected override void* getStruct()
71 	{
72 		return cast(void*)shumateMarker;
73 	}
74 
75 	/**
76 	 * Sets our main struct and passes it to the parent class.
77 	 */
78 	public this (ShumateMarker* shumateMarker, bool ownedRef = false)
79 	{
80 		this.shumateMarker = shumateMarker;
81 		super(cast(GtkWidget*)shumateMarker, ownedRef);
82 	}
83 
84 	// add the Location capabilities
85 	mixin LocationT!(ShumateMarker);
86 
87 
88 	/** */
89 	public static GType getType()
90 	{
91 		return shumate_marker_get_type();
92 	}
93 
94 	/**
95 	 * Creates an instance of #ShumateMarker.
96 	 *
97 	 * Returns: a new #ShumateMarker.
98 	 *
99 	 * Throws: ConstructionException GTK+ fails to create the object.
100 	 */
101 	public this()
102 	{
103 		auto __p = shumate_marker_new();
104 
105 		if(__p is null)
106 		{
107 			throw new ConstructionException("null returned by new");
108 		}
109 
110 		this(cast(ShumateMarker*) __p);
111 	}
112 
113 	/** */
114 	public void animateIn()
115 	{
116 		shumate_marker_animate_in(shumateMarker);
117 	}
118 
119 	/** */
120 	public void animateInWithDelay(uint delay)
121 	{
122 		shumate_marker_animate_in_with_delay(shumateMarker, delay);
123 	}
124 
125 	/** */
126 	public void animateOut()
127 	{
128 		shumate_marker_animate_out(shumateMarker);
129 	}
130 
131 	/** */
132 	public void animateOutWithDelay(uint delay)
133 	{
134 		shumate_marker_animate_out_with_delay(shumateMarker, delay);
135 	}
136 
137 	/**
138 	 * Retrieves the current child of @marker.
139 	 *
140 	 * Returns: a #GtkWidget.
141 	 */
142 	public Widget getChild()
143 	{
144 		auto __p = shumate_marker_get_child(shumateMarker);
145 
146 		if(__p is null)
147 		{
148 			return null;
149 		}
150 
151 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
152 	}
153 
154 	/**
155 	 * Checks whether the marker is draggable.
156 	 *
157 	 * Returns: the draggable or not state of the marker.
158 	 */
159 	public bool getDraggable()
160 	{
161 		return shumate_marker_get_draggable(shumateMarker) != 0;
162 	}
163 
164 	/**
165 	 * Checks whether the marker is selectable.
166 	 *
167 	 * Returns: the selectable or not state of the marker.
168 	 */
169 	public bool getSelectable()
170 	{
171 		return shumate_marker_get_selectable(shumateMarker) != 0;
172 	}
173 
174 	/**
175 	 * Checks whether the marker is selected.
176 	 *
177 	 * Returns: %TRUE if the marker is selected, otherwise %FALSE
178 	 */
179 	public bool isSelected()
180 	{
181 		return shumate_marker_is_selected(shumateMarker) != 0;
182 	}
183 
184 	/**
185 	 * Sets the child widget of @marker.
186 	 *
187 	 * Params:
188 	 *     child = a #GtkWidget
189 	 */
190 	public void setChild(Widget child)
191 	{
192 		shumate_marker_set_child(shumateMarker, (child is null) ? null : child.getWidgetStruct());
193 	}
194 
195 	/**
196 	 * Sets the marker as draggable or not.
197 	 *
198 	 * Params:
199 	 *     value = the draggable state
200 	 */
201 	public void setDraggable(bool value)
202 	{
203 		shumate_marker_set_draggable(shumateMarker, value);
204 	}
205 
206 	/**
207 	 * Sets the marker as selectable or not.
208 	 *
209 	 * Params:
210 	 *     value = the selectable state
211 	 */
212 	public void setSelectable(bool value)
213 	{
214 		shumate_marker_set_selectable(shumateMarker, value);
215 	}
216 }